var reviveCount = 5;
var mapIds = [302050100, 302050200, 302050300];
var 准备地图 = 0;
var eventName = "荣耀活动_时空裂缝";

function init() {}

function onMonsterDamaged() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance(eventName);
    for (var b = 993120500; b <= 993122480; b += 20) {
        var d = c.setInstanceMap(b);
        d.resetFully()
    }
    return c
}

function onPlayerRegistered(d, c) {
    var a = c.getAPI().getNumberFromQuestInfo(500799, "index");
    for (var b = 993120500 + a * 100; b <= 993120500 + a * 100 + 0; b += 20) {
        d.getMapInstance(b).resetFully()
    }
    c.changeMap(993120500 + a * 100, 0);
    c.scheduleWarpTask(15 * 60, c.getAPI().getNumberFromQuestInfo(500798, "map"), "gloryMission", true, false)
}

function onPlayerRevived(b, a) {
    return false
}

function onMonsterKilled(a, b) {
    if (player.getMap().getNumMonsters() == 0) {
        player.getAPI().fieldEffect_ScreenMsg("monsterPark/clearF");
        player.getAPI().fieldEffect_PlayFieldSound("Party1/Clear", 100);
        player.getAPI().achievementRatio(player.getMapId() % 100 + 20);
        if (player.getMapId() % 100 == 80) {
            player.getAPI().playerMessage(-1, "确认了时空裂缝内部情况。可以通过传送口移动到外面了。")
        }
    }
}

function onMapChanged(c, b, a) {
    if (a < 993120500 || a > 993122480) {
        on玩家退场(c, b, false);
        return
    }
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function openNpc(c, b, d) {
    for (var a = 0; a < c.getPlayerCount(); a++) {
        c.getPlayers().get(a).getAPI().openNpc(b, d)
    }
}

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.setProperty("lock_" + b.getAPI().getNumberFromQuestInfo(500799, "index"), 0);
    c.unregisterPlayer(b)
};